<script lang='ts' setup name='DeprtmentEdit'>

import userEdit from "@/hook/useEdit";
import type { Department } from "@/api/types";

const saveOrUpdateURL = '/dept/saveOrUpdate'
const getByIdURL = '/dept/getById/'

const { clostDialog, id } = defineProps(["clostDialog", "id"])
const initObj = { name: "", address: "", leader: "" }

const { form, onSubmit } = userEdit<Department>(  saveOrUpdateURL,  getByIdURL,  clostDialog, id, initObj);

</script>



<template>


  <el-form :model="form" label-width="auto" style="max-width: 600px">
    <el-form-item label="部门名称">
      <el-input v-model="form.name" />
    </el-form-item>
    <el-form-item label="部门办公地址">
      <el-input v-model="form.address" />
    </el-form-item>
    <el-form-item label="部门主任（领导）">
      <el-input v-model="form.leader" />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">保存</el-button>
    </el-form-item>
  </el-form>


</template>

<style scoped></style>